package me.zhanshi123.lab4.entity;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.AllArgsConstructor;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

@Data
@AllArgsConstructor
public class Good {
    @JSONField(defaultValue = "-1")
    private int id;
    private String name;
    private String type;
    private String origin;
    private double price;
    @JSONField(format = "yyyy-MM-dd")
    private Date production;
    private String manufacturer;

    public Good(long id, String name, String type, String origin, BigDecimal price, java.sql.Date date, String manufacturer) {
        this((int) id, name, type, origin, price.doubleValue(), new Date(date.getTime()), manufacturer);
    }
}
